﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;
using Chromos.ActionEngine;
using Chromos.AIEngine;

namespace Chromos.Actors
{
	class ExplosiveBug : Enemy
    {
        const int moveSpeed = 80;

        public ExplosiveBug(Game1 game, Vector2 position, Vector2 velocity, ContentManager content, bool isStatic, string aggressiveness)
			: base(game, position, velocity, content, isStatic,  aggressiveness)
		{
			this.applyGravity = true;
		}

        protected override void initAIEngine()
		{
			aiEngine = new ActorAIEngine(this, "normal", 300);
		}

		protected override void initActorFields()
		{
			base.initActorFields();
			this.health = 40;
			this.mass = 20;
		}

		public override Projectile createProjectiles(int i)
		{
			return null;
		}

		public override void addActions()
		{
            // Create and add the various actions for this actor's idling, movement, attack, and defense.
            // NOTE: Uses VisualLoopingAction until VisualNonLoopingAction is made non-abstract.

            // ExplosiveBug Idle (nonLooping)
			IdleAction hover = new IdleAction(this, content, Vector2.Zero, ForceType.ForceInstant, 0);
            hover.addImageToLoad(@"Sprites/Enemies/RedUnits/ExplosiveBug/Move/ExplosiveBugLeft1");
            hover.addImageToLoad(@"Sprites/Enemies/RedUnits/ExplosiveBug/Move/ExplosiveBugLeft2");


            // ExplosiveBug Move Left
			WalkAction moveLeft = new WalkAction(this, content, new Vector2(0, -moveSpeed), ForceType.ForceContinuous, 50, FACING.LEFT);
            moveLeft.addImageToLoad(@"Sprites/Enemies/RedUnits/ExplosiveBug/Move/ExplosiveBugLeft1");
            moveLeft.addImageToLoad(@"Sprites/Enemies/RedUnits/ExplosiveBug/Move/ExplosiveBugLeft2");

            // ExplosiveBug Move Right
			WalkAction moveRight = new WalkAction(this, content, new Vector2(0, moveSpeed), ForceType.ForceContinuous, 50, FACING.RIGHT);
            moveRight.addImageToLoad(@"Sprites/Enemies/RedUnits/ExplosiveBug/Move/ExplosiveBugRight1");
            moveRight.addImageToLoad(@"Sprites/Enemies/RedUnits/ExplosiveBug/Move/ExplosiveBugRight2");


            // ExplosiveBug Explode Left (nonLooping)
			AttackAction explodeLeft = new AttackAction(this, content, Vector2.Zero, ForceType.ForceInstant, 50, createProjectiles, 0, 0, 0, 500, 0, 0, 0, null, null, FACING.LEFT, false);
            explodeLeft.addImageToLoad(@"Sprites/Enemies/RedUnits/ExplosiveBug/Explosion/ExplosionLeft1");
            explodeLeft.addImageToLoad(@"Sprites/Enemies/RedUnits/ExplosiveBug/Explosion/ExplosionLeft2");
            explodeLeft.addImageToLoad(@"Sprites/Enemies/RedUnits/ExplosiveBug/Explosion/ExplosionLeft3");
            explodeLeft.addImageToLoad(@"Sprites/Enemies/RedUnits/ExplosiveBug/Explosion/ExplosionLeft4");

            // ExplosiveBug Explode Right (nonLooping)
			AttackAction explodeRight = new AttackAction(this, content, Vector2.Zero, ForceType.ForceInstant, 50, createProjectiles, 0, 0, 0, 500, 0, 0, 0, null, null, FACING.RIGHT, false);
            explodeRight.addImageToLoad(@"Sprites/Enemies/RedUnits/ExplosiveBug/Explosion/ExplosionRight1");
            explodeRight.addImageToLoad(@"Sprites/Enemies/RedUnits/ExplosiveBug/Explosion/ExplosionRight2");
            explodeRight.addImageToLoad(@"Sprites/Enemies/RedUnits/ExplosiveBug/Explosion/ExplosionRight3");
            explodeRight.addImageToLoad(@"Sprites/Enemies/RedUnits/ExplosiveBug/Explosion/ExplosionRight4");

			// Add everything to the correct action list
			actionEngine.addIdle(hover);
			actionEngine.addMovement(moveLeft);
			actionEngine.addMovement(moveRight);
            actionEngine.addAttack(explodeLeft);
            actionEngine.addAttack(explodeRight);
		}
    }
}
